home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / oriel.arc / DRAW.ORL < prev    next >
Text File  |  1991-07-31  |  13KB  |  504 lines

  1. {------------------------------DRAW.ORL-------------------------------
  2.  This script lets you draw a variety of graphic shapes by clicking on
  3.  various points in the window.
  4.  --------------------------------------------------------------------}
  5.  
  6. {Establish Default Environment}
  7.     UseCaption("Oriel Draw")
  8.     SetWindow(Maximize)
  9.     UseCoordinates(Metric)
  10.     UsePen(SOLID,3,0,0,0)
  11.     Set P_Red = 0
  12.     Set P_Green = 0
  13.     Set P_Blue = 0
  14.     UseBrush(SOLID,255,0,0)
  15.     Set Br_Red = 255
  16.     Set Br_Green = 0
  17.     Set Br_Blue = 0
  18.     UseBackground(OPAQUE,255,255,255)
  19.     DrawBackground
  20.     DrawLine(0,130,280,130)
  21.  
  22. Draw_Menu:
  23.     SetMenu("&Figures",IGNORE,
  24.           "&Line",        DR_LINE,
  25.           "&Rectangle",        DR_RECTANGLE,
  26.           "&Round Rectangle",    DR_ROUNDR,
  27.           "&Ellipse",        DR_ELLIPSE,
  28.           "&Pie",        DR_PIE,
  29.           "&Arc",        DR_ARC,
  30.           "&Chord",        DR_CHORD,
  31.           ENDPOPUP,
  32.         "&Brush Color",IGNORE,
  33.           "&White",                BRUSH_WHITE,
  34.           "&Gray",        BRUSH_GRAY,
  35.           "&Red",        BRUSH_RED,
  36.           "&Yellow",        BRUSH_YEL,
  37.           "Gree&n",        BRUSH_GRN,
  38.           "&Light Blue",    BRUSH_LTBLU,
  39.           "&Blue",        BRUSH_BLUE,
  40.           "&Pink",        BRUSH_PINK,
  41.           "Blac&k",        BRUSH_BLACK,
  42.           ENDPOPUP,
  43.         "&Pen Color",IGNORE,
  44.           "&White",        Pen_WHITE,
  45.           "&Gray",        Pen_GRAY,
  46.           "&Red",        Pen_RED,
  47.           "&Yellow",        Pen_YEL,
  48.           "Gree&n",        Pen_GRN,
  49.           "&Light Blue",    Pen_LTBLU,
  50.           "&Blue",        Pen_BLUE,
  51.           "&Pink",        Pen_PINK,
  52.           "Blac&k",        Pen_BLACK,
  53.           ENDPOPUP,
  54.         "&Exit!",Exit_proc,
  55.           ENDPOPUP)
  56.  
  57.  
  58. {Draw tool boxes}
  59.     Gosub Draw_Boxes
  60.  
  61. {Highlight the line tool}
  62.     UsePen(SOLID,3,0,0,0)
  63.     UseBrush(NULL,0,0,0)
  64.     Gosub Line_Box
  65.     Set Box_select=1
  66.  
  67. {Draw tools}
  68.     UseFont("Helv",0,3,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  69.     UseBrush(SOLID,255,0,0)
  70.     UsePen(SOLID,2,0,0,0)
  71.  
  72.     DrawText(1,1,"1")        {Line}
  73.     DrawLine(4,5,22,10)
  74.     DrawText(23,9,"2")
  75.  
  76.     DrawText(31,1,"1")        {Rectangle}
  77.     DrawRectangle(34,3,56,12)
  78.     DrawText(57,10,"2")
  79.  
  80.     DrawText(61,1,"1")        {Round Rectangle}
  81.     DrawRoundRectangle(64,3,86,12,3,3)
  82.     DrawText(87,10,"2")
  83.  
  84.     UseBrush(NULL,0,0,0)        {Ellipse}
  85.     UsePen(DOT,1,0,0,0)
  86.     DrawText(91,1,"1")
  87.     DrawRectangle(94,3,116,12)
  88.     DrawText(116,10,"2")
  89.     UseBrush(SOLID,255,0,0)
  90.     UsePen(SOLID,2,0,0,0)
  91.     DrawEllipse(94,3,116,12)
  92.  
  93.     UseBrush(NULL,0,0,0)        {Pie}
  94.     UsePen(DOT,1,0,0,0)
  95.     DrawText(121,1,"1")
  96.     DrawRectangle(124,3,146,12)
  97.     DrawEllipse(124,3,146,12)
  98.     DrawText(146,10,"2")
  99.     UseBrush(SOLID,255,0,0)
  100.     UsePen(SOLID,2,0,0,0)
  101.     DrawPie(124,3,146,12,146,7,126,3)
  102.     DrawText(146,5,"3")
  103.     DrawText(126,0,"4")
  104.  
  105.     UseBrush(NULL,0,0,0)        {Arc}
  106.     UsePen(DOT,1,0,0,0)
  107.     DrawText(151,1,"1")
  108.     DrawRectangle(154,3,176,12)
  109.     DrawEllipse(154,3,176,12)
  110.     DrawText(176,10,"2")
  111.     UseBrush(SOLID,255,0,0)
  112.     UsePen(SOLID,2,0,0,0)
  113.     DrawArc(154,3,176,12,176,7,156,3)
  114.     DrawText(176,5,"3")
  115.     DrawText(156,0,"4")
  116.  
  117.     UseBrush(NULL,0,0,0)        {Chord}
  118.     UsePen(DOT,1,0,0,0)
  119.     DrawText(181,1,"1")
  120.     DrawRectangle(184,3,206,12)
  121.     DrawEllipse(184,3,206,12)
  122.     DrawText(206,10,"2")
  123.     UseBrush(SOLID,255,0,0)
  124.     UsePen(SOLID,2,0,0,0)
  125.     DrawChord(184,3,206,12,206,7,186,3)
  126.     DrawText(206,5,"3")
  127.     DrawText(186,0,"4")
  128.  
  129. {Reset the font}
  130.     UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  131.  
  132. {Line}
  133. Dr_Line:
  134.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  135.         0,16,60000,130,line2,POS_X,POS_Y)
  136.    Gosub Draw_Blank
  137.    DrawText(25,136,"(1) Click on the beginning of the line")
  138.    WaitInput()
  139. line2:
  140.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  141.         0,16,60000,130,line_end,pos_x1,pos_y1)
  142.    Gosub Draw_Blank
  143.    DrawText(25,136,"(2) Click on the end point of the line")
  144.    WaitInput()
  145. line_end:
  146.    DrawLine(pos_x,pos_y,pos_x1,pos_y1)
  147.    Goto Dr_Line
  148.  
  149. {Rectangle}
  150. dr_rectangle:
  151.    set rec_type = 0
  152.    goto dr_rect
  153.  
  154. {Round Rectangle}
  155. dr_roundr:
  156.    set rec_type = 1
  157.    goto dr_rect
  158.  
  159. Dr_rect:
  160.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  161.         0,16,60000,130,rectangle2,POS_X,POS_Y)
  162.    Gosub Draw_Blank
  163.    DrawText(25,136,"(1) Click on the upper-left corner of the rectangle")
  164.    WaitInput()
  165. rectangle2:
  166.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  167.         0,16,60000,130,rect_end,pos_x1,pos_y1)
  168.    Gosub Draw_Blank
  169.    DrawText(25,136,"(2) Click on the lower-right corner of the rectangle")
  170.    WaitInput()
  171. rect_end:
  172.    if rec_type = 0 then DrawRectangle(pos_x,pos_y,pos_x1,pos_y1) | goto dr_rect
  173.    DrawRoundRectangle(pos_x,pos_y,pos_x1,pos_y1,12,9)
  174.    Goto dr_rect
  175.  
  176. {Ellipse}
  177. dr_ellipse:
  178.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  179.         0,16,60000,130,ellipse2,POS_X,POS_Y)
  180.    Gosub Draw_Blank
  181.    DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the ellipse")
  182.    WaitInput()
  183. ellipse2:
  184.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  185.         0,16,60000,130,ellipse_end,pos_x1,pos_y1)
  186.    Gosub Draw_Blank
  187.    DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the ellipse")
  188.    WaitInput()
  189. ellipse_end:
  190.    DrawEllipse(pos_x,pos_y,pos_x1,pos_y1)
  191.    Goto dr_ellipse
  192.  
  193. {Pie}
  194. dr_pie:
  195.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  196.         0,16,60000,130,pie2,POS_X,POS_Y)
  197.    Gosub Draw_Blank
  198.    DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the pie's ellipse")
  199.    WaitInput()
  200. pie2:
  201.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  202.         0,16,60000,130,pie3,pos_x1,pos_y1)
  203.    Gosub Draw_Blank
  204.    DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the pie's ellipse")
  205.    WaitInput()
  206. pie3:
  207.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  208.         0,16,60000,130,pie4,pos_x2,pos_y2)
  209.    Gosub Draw_Blank
  210.    DrawText(25,136,"(3) Click on one end of the arc that defines the pie")
  211.    WaitInput()
  212. pie4:
  213.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  214.         0,16,60000,130,pie_end,pos_x3,pos_y3)
  215.    Gosub Draw_Blank
  216.    DrawText(25,136,"(4) Click on the other end of the arc that defines the pie")
  217.    WaitInput()
  218.  
  219. pie_end:
  220.    DrawPie(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
  221.    Goto dr_pie
  222.  
  223. {Arc}
  224. dr_arc:
  225.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  226.         0,16,60000,130,arc2,POS_X,POS_Y)
  227.    Gosub Draw_Blank
  228.    DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the arc")
  229.    WaitInput()
  230. arc2:
  231.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  232.         0,16,60000,130,arc3,POS_X1,POS_Y1)
  233.    Gosub Draw_Blank
  234.    DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the arc")
  235.    WaitInput()
  236. arc3:
  237.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  238.         0,16,60000,130,arc4,pos_x2,pos_y2)
  239.    Gosub Draw_Blank
  240.    DrawText(25,136,"(3) Click on the arc's start point")
  241.    WaitInput()
  242. arc4:
  243.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  244.         0,16,60000,130,arc_end,pos_x3,pos_y3)
  245.    Gosub Draw_Blank
  246.    DrawText(25,136,"(4) Click on the arc's end point")
  247.    WaitInput()
  248.  
  249. arc_end:
  250.    DrawArc(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
  251.    Goto dr_arc
  252.  
  253. {Chord}
  254. dr_chord:
  255.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  256.         0,16,60000,130,chord2,POS_X,POS_Y)
  257.    Gosub Draw_Blank
  258.    DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the chord's ellipse")
  259.    WaitInput()
  260. chord2:
  261.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  262.         0,16,60000,130,chord3,pos_x1,pos_y1)
  263.    Gosub Draw_Blank
  264.    DrawText(25,136,"(2) Click on lower-right corner of the rectangle bounding the chord's ellipse")
  265.    WaitInput()
  266. chord3:
  267.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  268.         0,16,60000,130,chord4,pos_x2,pos_y2)
  269.    Gosub Draw_Blank
  270.    DrawText(25,136,"(3) Click on one point of the line that defines the chord")
  271.    WaitInput()
  272. chord4:
  273.    SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  274.         0,16,60000,130,chord_end,pos_x3,pos_y3)
  275.    Gosub Draw_Blank
  276.    DrawText(25,136,"(4) Click on the second point of the line that defines the chord")
  277.    WaitInput()
  278.  
  279. chord_end:
  280.    DrawChord(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
  281.    Goto dr_chord
  282.  
  283. {Change Brush Colors}
  284. BRUSH_WHITE:
  285.    UseBrush(SOLID,255,255,255)
  286.    Set Br_Red=255
  287.    Set Br_Green=255
  288.    Set Br_Blue=255
  289.    Goto Leave_Box
  290.  
  291. BRUSH_GRAY:
  292.    UseBrush(SOLID,192,192,192)
  293.    Set Br_Red=192
  294.    Set Br_Green=192
  295.    Set Br_Blue=192
  296.    Goto Leave_Box
  297.  
  298. BRUSH_RED:
  299.    UseBrush(SOLID,255,0,0)
  300.    Set Br_Red=255
  301.    Set Br_Green=0
  302.    Set Br_Blue=0
  303.    Goto Leave_Box
  304.  
  305. BRUSH_YEL:
  306.    UseBrush(SOLID,255,255,0)
  307.    Set Br_Red=255
  308.    Set Br_Green=255
  309.    Set Br_Blue=0
  310.    Goto Leave_Box
  311.  
  312. BRUSH_GRN:
  313.    UseBrush(SOLID,0,255,0)
  314.    Set Br_Red=0
  315.    Set Br_Green=255
  316.    Set Br_Blue=0
  317.    Goto Leave_Box
  318.  
  319. BRUSH_LTBLU:
  320.    UseBrush(SOLID,0,255,255)
  321.    Set Br_Red=0
  322.    Set Br_Green=255
  323.    Set Br_Blue=255
  324.    Goto Leave_Box
  325.  
  326. BRUSH_BLUE:
  327.    UseBrush(SOLID,0,0,255)
  328.    Set Br_Red=0
  329.    Set Br_Green=0
  330.    Set Br_Blue=255
  331.    Goto Leave_Box
  332.  
  333. BRUSH_PINK:
  334.    UseBrush(SOLID,255,0,255)
  335.    Set Br_Red=255
  336.    Set Br_Green=0
  337.    Set Br_Blue=255
  338.    Goto Leave_Box
  339.  
  340. BRUSH_Black:
  341.    UseBrush(SOLID,0,0,0)
  342.    Set Br_Red=0
  343.    Set Br_Green=0
  344.    Set Br_Blue=0
  345.    Goto Leave_Box
  346.  
  347. {Change Pen Colors}
  348. Pen_White:
  349.    UsePen(SOLID,2,255,255,255)
  350.    Set P_Red=255
  351.    Set P_Green=255
  352.    Set P_Blue=255
  353.    Goto Leave_Box
  354.  
  355. Pen_GRAY:
  356.    UsePen(SOLID,2,192,192,192)
  357.    Set P_Red=192
  358.    Set P_Green=192
  359.    Set P_Blue=192
  360.    Goto Leave_Box
  361.  
  362. Pen_RED:
  363.    UsePen(SOLID,2,255,0,0)
  364.    Set P_Red=255
  365.    Set P_Green=0
  366.    Set P_Blue=0
  367.    Goto Leave_Box
  368.  
  369. Pen_YEL:
  370.    UsePen(SOLID,2,255,255,0)
  371.    Set P_Red=255
  372.    Set P_Green=255
  373.    Set P_Blue=0
  374.    Goto Leave_Box
  375.  
  376. Pen_GRN:
  377.    UsePen(SOLID,2,0,255,0)
  378.    Set P_Red=0
  379.    Set P_Green=255
  380.    Set P_Blue=0
  381.    Goto Leave_Box
  382.  
  383. Pen_LTBLU:
  384.    UsePen(SOLID,2,0,255,255)
  385.    Set P_Red=0
  386.    Set P_Green=255
  387.    Set P_Blue=255
  388.    Goto Leave_Box
  389.  
  390. Pen_BLUE:
  391.    UsePen(SOLID,2,0,0,255)
  392.    Set P_Red=0
  393.    Set P_Green=0
  394.    Set P_Blue=255
  395.    Goto Leave_Box
  396.  
  397. Pen_PINK:
  398.    UsePen(SOLID,2,255,0,255)
  399.    Set P_Red=255
  400.    Set P_Green=0
  401.    Set P_Blue=255
  402.    Goto Leave_Box
  403.  
  404. Pen_Black:
  405.    UsePen(SOLID,2,0,0,0)
  406.    Set P_Red=0
  407.    Set P_Green=0
  408.    Set P_Blue=0
  409.    Goto Leave_Box
  410.  
  411. {Subroutine to erase current text}
  412. Draw_Blank:
  413.     UsePen(NULL,1,0,0,0)
  414.     UseBrush(SOLID,255,255,255)
  415.     DrawRectangle(25,136,250,145)
  416.     UsePen(SOLID,2,P_Red,P_Green,P_Blue)
  417.     UseBrush(SOLID,Br_Red,Br_Green,Br_Blue)
  418.     Return
  419.  
  420. {Move the highlight to the selected tool}
  421. Move_Hilite:
  422.     Set Box_Select_Old = Box_Select
  423.     UseBrush(NULL,0,0,0)
  424.  
  425. {Erase the old highlight}
  426.     UsePen(SOLID,3,255,255,255)    {White pen}
  427.     If Box_Select_Old = 1 Then Gosub Line_Box | Goto New_Hilite
  428.     If Box_Select_Old = 2 Then Gosub Rect_Box | Goto New_Hilite
  429.     If Box_Select_Old = 3 Then Gosub RoundRect_Box | Goto New_Hilite
  430.     If Box_Select_Old = 4 Then Gosub Ellipse_Box | Goto New_Hilite
  431.     If Box_Select_Old = 5 Then Gosub Pie_Box | Goto New_Hilite
  432.     If Box_Select_Old = 6 Then Gosub Arc_Box | Goto New_Hilite
  433.                 {Else} Gosub Chord_Box
  434.  
  435. {Draw the new highlight}
  436. New_Hilite:
  437.     UsePen(SOLID,3,0,0,0)        {Black pen}
  438.     If POS_X <= 30 Then Set Box_Select=1 | Gosub Line_Box | Goto Leave_Box
  439.     If POS_X <= 60 Then Set Box_Select=2 | Gosub Rect_Box | Goto Leave_Box
  440.     If POS_X <= 90 Then Set Box_Select=3 | Gosub RoundRect_Box | Goto Leave_Box
  441.     If POS_X <= 120 Then Set Box_Select=4 | Gosub Ellipse_Box | Goto Leave_Box
  442.     If POS_X <= 150 Then Set Box_Select=5 | Gosub Pie_Box | Goto Leave_Box
  443.     If POS_X <= 180 Then Set Box_Select=6 | Gosub Arc_Box | Goto Leave_Box
  444.               {Else} Set Box_Select=7 | Gosub Chord_Box
  445.  
  446. {Reset the brush and pen and branch to the appropriate routine}
  447. Leave_Box:
  448.     Gosub Draw_Boxes
  449.     If Box_Select = 1 Then Goto Dr_Line
  450.     If Box_Select = 2 Then Goto Dr_Rectangle
  451.     If Box_Select = 3 Then Goto Dr_RoundR
  452.     If Box_Select = 4 Then Goto Dr_Ellipse
  453.     If Box_Select = 5 Then Goto Dr_Pie
  454.     If Box_Select = 6 Then Goto Dr_Arc
  455.             {Else} Goto Dr_Chord
  456.  
  457. {Exit!}
  458. Exit_Proc:
  459.    End
  460.  
  461. {Subroutines for highligting drawing tools}
  462. Line_Box:
  463.     DrawRectangle(0,0,30,16)
  464.     Return
  465.  
  466. Rect_Box:
  467.     DrawRectangle(30,0,60,16)
  468.     Return
  469.  
  470. RoundRect_Box:
  471.     DrawRectangle(60,0,90,16)
  472.     Return
  473.  
  474. Ellipse_Box:
  475.     DrawRectangle(90,0,120,16)
  476.     Return
  477.  
  478. Pie_Box:
  479.     DrawRectangle(120,0,150,16)
  480.     Return
  481.  
  482. Arc_Box:
  483.     DrawRectangle(150,0,180,16)
  484.     Return
  485.  
  486. Chord_Box:
  487.     DrawRectangle(180,0,210,16)
  488.     Return
  489.  
  490. {Draw tool boxes}
  491. Draw_Boxes:
  492.     UsePen(SOLID,2,0,0,0)
  493.     DrawLine(0,16,1000,16)        {Solid line across the window}
  494.     UsePen(SOLID,1,0,0,0)        {Lines between drawing tools}
  495.     DrawLine(30,0,30,16)
  496.     DrawLine(60,0,60,16)
  497.     DrawLine(90,0,90,16)
  498.     DrawLine(120,0,120,16)
  499.     DrawLine(150,0,150,16)
  500.     DrawLine(180,0,180,16)
  501. {Reset the pen and brush}
  502.     UsePen(SOLID,2,P_Red,P_Green,P_Blue)
  503.     UseBrush(SOLID,Br_Red,Br_Green,Br_Blue)
  504.     Return